<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/database.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/functions.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.admin.php');
$admin=new admin();
$admin->canView($_SERVER['PHP_SELF']);
$is_parent=($_POST['add_page_parent']=='') ? 1 : 0;
$parent=($is_parent==1) ? '' : $_POST['add_page_parent'];
/* Path */

	$url=$_POST['add_page_url'];	

$groups=(count($_POST['add_page_group'])>=1) ? $_POST['add_page_group']  : array(); // array
//if(empty($groups
$item=array(
			'text'=>$_POST['add_page_name'],
			'timestamp'=>intval(time()),
			'url'=>$url,
			'is_parent'=>$is_parent,
			'parent'=>$parent,
			'active'=>intval(0),
			'include_in_nav'=>intval($_POST['add_page_include_in_nav']),
			'order'=>intval($_POST['add_page_order']),
			'heading'=>$_POST['add_page_heading'],
			'sidebar'=>intval($_POST['add_page_sidebar']),
			'requires_auth'=>intval($_POST['add_page_requires_auth']),
			'cache'=>intval(1),
			'is_blog'=>$_POST['add_page_is_blog'],
			'content'=>'Input some content',
			'groups'=>$groups,
			'meta'=>array(			
							'keywords'=>'',
							'title'=>'New document',
							'description'=>'',
							'custom'=>'')
			);
$admin->addPage($item);
//$output=add_page($item); // change
// then add some content
// we now have the array of output.. 



?>
<script>
$.fn.loader('add_page_form');
$.fn.loader('current_pages_list');

</script>
